package com.example.daliy.mythread;


import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

public class MyThread {
    public static void main(String[] args) throws InterruptedException {
        ReentrantLock reentrantLock = new ReentrantLock();
        ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock();
        ReentrantReadWriteLock.ReadLock readLock = reentrantReadWriteLock.readLock();
        ReentrantReadWriteLock.WriteLock writeLock = reentrantReadWriteLock.writeLock();
        writeLock.lock();
        readLock.lock();
        ExecutorService executorService = Executors.newFixedThreadPool(10);
         ThreadLocal<String> stringThreadLocal = new ThreadLocal<>();
        ThreadLocal<Integer> integerThreadLocal = new ThreadLocal<>();

        stringThreadLocal.set("1");
        integerThreadLocal.set(2);
        String s = stringThreadLocal.get();
        Integer integer = integerThreadLocal.get();
        System.out.println(s);
        System.out.println(integer);
        Object o = new Object();
        o.wait(1000);
        o.notifyAll();




        reentrantLock.lock();
        try {
            Thread.sleep(1000L);
        } catch (InterruptedException e) {


        } finally {
            reentrantLock.unlock();
        }
    }
}
